package controller;


import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

public class ExitServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        request.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=utf-8");
        HttpSession session  = request.getSession();
        request.getSession().setAttribute("name",null);
        session.removeAttribute("name");
        System.out.println("llll");
        request.setAttribute("result", "成功退出登陆！");
        request.getRequestDispatcher("/").forward(request,response);
    }
}
